package defpackage; import android.text.TextUtils; import cn.wps.util.JSONUtil; import com.google.firebase.analytics.FirebaseAnalytics; import com.iflytek.cloud.SpeechEvent; import com.iflytek.cloud.SpeechUtility; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* renamed from: gvk reason: default package */ public class gvk { private static final String TAG = gvk.class.getSimpleName(); public static String asP() { return fok.bBq().getWPSSid(); } private static String c(TreeMap<String, String> treeMap) { StringBuffer stringBuffer = new StringBuffer(); for (Map.Entry<String, String> entry : treeMap.entrySet()) { stringBuffer.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); } String stringBuffer2 = stringBuffer.toString(); return stringBuffer2.endsWith("&") ? stringBuffer2.substring(0, stringBuffer2.length() - 1) : stringBuffer2; } public static int cw(String str, String str2) throws IOException, JSONException { TreeMap treeMap = new TreeMap(); treeMap.put("userid", str); treeMap.put("offer_type", str2); treeMap.put("app_id", "wps_android"); treeMap.put("sig", lvo.cm(d(treeMap) + "andfe65idk1or03si8")); try { String c = lwd.c("https://vip.wps.cn/task/api/wealth_reward", c(treeMap), null); if (c != null) { try { JSONObject jSONObject = new JSONObject(c); if ("ok".equals(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { return jSONObject.getJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA).optInt("wealth"); } if ("task_finish".equals(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT)) || "max_reward_limit".endsWith(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { return 0; } } catch (JSONException e) { e.getMessage(); throw e; } } return -1; } catch (IOException e2) { e2.getMessage(); throw e2; } } public static List<gwd> cx(String str, String str2) { String str3; TreeMap treeMap = new TreeMap(); if (!TextUtils.isEmpty(str)) { treeMap.put("userid", str); } treeMap.put("platform", "8"); treeMap.put("app_id", "wps_android"); treeMap.put(FirebaseAnalytics.Param.SOURCE, str2); treeMap.put("sig", lvo.cm(d(treeMap) + "andfe65idk1or03si8")); StringBuilder sb = new StringBuilder(); for (String str4 : treeMap.keySet()) { sb.append(str4).append("=").append((String) treeMap.get(str4)).append("&"); } sb.deleteCharAt(sb.length() - 1); String str5 = "https://vip.wps.cn/task/android?" + sb.toString(); ArrayList arrayList = new ArrayList(); try { str3 = lwd.f(str5, null); } catch (Exception e) { e.getMessage(); str3 = null; } if (str3 != null) { try { JSONObject jSONObject = new JSONObject(str3); if ("ok".equals(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { JSONArray jSONArray = jSONObject.getJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA).getJSONArray(SpeechEvent.KEY_EVENT_RECORD_DATA); for (int i = 0; i < jSONArray.length(); i++) { arrayList.add(JSONUtil.getGson().fromJson(jSONArray.getString(i), gwd.class)); } } } catch (JSONException e2) { e2.getMessage(); } } return arrayList; } private static String d(TreeMap<String, String> treeMap) { StringBuffer stringBuffer = new StringBuffer(); for (Map.Entry<String, String> entry : treeMap.entrySet()) { stringBuffer.append(entry.getKey()).append("=").append(entry.getValue()); } return stringBuffer.toString(); } public static int q(String str, long j) throws IOException, JSONException { String str2 = null; TreeMap treeMap = new TreeMap(); treeMap.put("userid", str); if (j > 10800000) { str2 = "android_use_time3"; } else if (j > 7200000) { str2 = "android_use_time2"; } else if (j > 3600000) { str2 = "android_use_time1"; } else if (j > 1800000) { str2 = "android_use_time30"; } treeMap.put("offer_type", str2); treeMap.put("app_id", "wps_android"); treeMap.put("sig", lvo.cm(d(treeMap) + "andfe65idk1or03si8")); try { String c = lwd.c("https://vip.wps.cn/task/api/exp_reward", c(treeMap), null); if (c != null) { try { JSONObject jSONObject = new JSONObject(c); if ("ok".equals(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { return jSONObject.getJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA).optInt("exp"); } if ("task_finish".equals(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT)) || "max_reward_limit".endsWith(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { return 0; } } catch (JSONException e) { e.getMessage(); throw e; } } return -1; } catch (IOException e2) { e2.getMessage(); throw e2; } } public static ArrayList<String> xD(String str) throws IOException, JSONException { ArrayList<String> arrayList = new ArrayList<>(); TreeMap treeMap = new TreeMap(); treeMap.put("userid", str); treeMap.put("platform", "8"); treeMap.put("app_id", "wps_android"); treeMap.put("sig", lvo.cm(d(treeMap) + "andfe65idk1or03si8")); try { String c = lwd.c("https://vip.wps.cn/task/api/finish", c(treeMap), null); if (c != null) { try { JSONObject jSONObject = new JSONObject(c); if ("ok".equals(jSONObject.optString(SpeechUtility.TAG_RESOURCE_RESULT))) { JSONArray jSONArray = jSONObject.getJSONArray(SpeechEvent.KEY_EVENT_RECORD_DATA); for (int i = 0; i < jSONArray.length(); i++) { arrayList.add(jSONArray.getString(i)); } } } catch (JSONException e) { e.getMessage(); throw e; } } return arrayList; } catch (IOException e2) { e2.getMessage(); throw e2; } } }